﻿namespace Chain.Wechat
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Xml;

    public class TextResponse : IResponse
    {
        
        private string _Content;

        public TextResponse(IRequest req) : this(req, "")
        {
        }

        public TextResponse(IRequest req, string content) : base(req)
        {
            base.Request = req;
            this.Content = content;
            XmlNode xml = base.XmlDoc.GetElementsByTagName("xml")[0];
            XmlElement nodeMsgType = base.XmlDoc.CreateElement("MsgType");
            XmlCDataSection xmlCData = base.XmlDoc.CreateCDataSection("text");
            nodeMsgType.AppendChild(xmlCData);
            xml.AppendChild(nodeMsgType);
            XmlElement nodeContent = base.XmlDoc.CreateElement("Content");
            xmlCData = base.XmlDoc.CreateCDataSection(content);
            nodeContent.AppendChild(xmlCData);
            xml.AppendChild(nodeContent);
        }

        public string Content
        {
            
            get
            {
                return this._Content;
            }
            
            set
            {
                this._Content = value;
            }
        }
    }
}

